<?php

class ListenerHelper extends AppHelper
{
	var $helpers = array('Javascript');
	
	
	function add($ids)
	{
		$url = Router::url(array(
			'plugin' => $this->params['plugin'],
		    'controller' => $this->params['controller'],
		    'action' => 'getStatus',
		    'admin' => true
		));
		//echo $url; exit;
		$ids = implode(';',$ids);
		$currentStatuses = $this->requestAction($url, array('form'=>array('ids'=>$ids)));
		//echo ($currentStatuses); exit;
		$this->getView()->addScript('listener', $this->Javascript->link('/cms/js/listener.js'));
		$this->getView()->addScript('listeningIds', $this->Javascript->codeBlock("var currentStatuses=".$currentStatuses.";"));
		$this->Javascript->startup("$.listenStatus('".$url."', '".$ids."');");
	}
	
	
}


?>
